<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--bootstrap插件-->
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="/static/plugin/bootstrap/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugin/jo/joUI.css" rel="stylesheet"/>
    <!--字体插件-->
    <link href="/static/plugin/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugin/layui-2.4.3/css/layui.css" rel="stylesheet"/>
    <!--ztree-->
    <link href="/static/plugin/zTree/css/metroStyle/metroStyle.css" rel="stylesheet"/>
    <!--common-->
    <link href="/static/css/common.css" rel="stylesheet"/>
    <title>职位信息表单</title>
</head>
<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
            <ul class="nav nav-tabs" role="tablist" id="tab-option" style="display: none;">
                <li class="active" role="presentation">
                    <a data-toggle="tab" href="#baseInfo" aria-controls="exampleTabsInverseOne" role="tab" aria-expanded="true">
                        职位信息
                    </a>
                </li>
                <li role="presentation" class="">
                    <a data-toggle="tab" href="#yixiang" aria-controls="exampleTabsInverseTwo" role="tab" aria-expanded="false">
                        投递意向
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="tab-content">
        <!--基本信息-->
        <div class="tab-pane active" id="baseInfo" role="tabpanel">
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <!--按钮栏-->
                    <div class="form-group button-bar button-bar">
                        <button type="button" isShow="joForm.isAdd" class="btn btn-primary" onclick="joForm.save()">
                            <i class="fa fa-plus-circle" aria-hidden="true"></i>&nbsp;新增
                        </button>
                        <button type="button" isShow="!joForm.isAdd" class="btn btn-info" onclick="joForm.update()">
                            <i class="fa fa-pencil-square" aria-hidden="true"></i>&nbsp;修改
                        </button>
                        <button type="button" isShow="!joForm.isAdd" class="btn btn-danger" onclick="joForm.del()">
                            <i class="fa fa-trash" aria-hidden="true"></i>&nbsp;删除
                        </button>
                    </div>
                    <!--按钮栏-->
                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                        <form id="pageForm" name="pageForm" action="" method="post">
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">招聘职位</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <input type="text"   name="jobName" value="" class="form-control "  ErrEmpty="招聘职位不允许为空" />
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">商户编号</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <select name="merchantId" value="" class="joSelect form-control" data="" dataurl="/recruit/merchant/getList" keyfield="id" valuefield="name" firstitem='{"id":"","name":""}' ErrEmpty="商户编号不允许为空" ></select>
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 ">
                                <div class="young-form-label">招聘人数</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <input type="text"   name="needPersonNum" value="1" class="form-control "  ErrNumber="招聘人数需填写数字类型" />
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">工作地址</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <input type="text"   name="jobAddr" value="" class="form-control "  ErrEmpty="工作地址不允许为空" />
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">工作说明</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <textarea  name="jobExplain" value="" class="form-control "  ErrEmpty="工作说明不允许为空"></textarea>
                                </div>
                            </div>
                            <!--<div class="young-form-item col-md-6 must">
                                <div class="young-form-label">发布状态</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <input type="text"   name="publishStatus" value="" class="form-control "  ErrEmpty="发布状态不允许为空" />
                                </div>
                            </div>-->

                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">工作时间</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <!--<input type="text"   name="jobTime" value="" class="form-control "  ErrEmpty="工作时间不允许为空" />-->
                                    <input type="text" id="jobTime" value="" name="jobTime" class="joInput form-control "  ErrEmpty="工作时间不允许为空" />
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">薪资</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <input type="text"   name="jobSalary" value="" class="form-control "  ErrNumber="薪资需填写数字类型" />
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">薪资单位</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <select name="jobSalaryUnit" value="" class="form-control" ErrEmpty="薪资单位不允许为空" >
                                        <option value=""></option>
                                        <option value="元/小时">元/小时</option>
                                        <option value="元/月">元/月</option>
                                    </select>
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 ">
                                <div class="young-form-label">福利补助</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <select name="jobWelfare" value="" class="form-control"  >
                                        <option value=""></option>
                                        <option value="管吃">管吃</option>
                                        <option value="全勤奖">全勤奖</option>
                                        <option value="其他">其他</option>
                                    </select>
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">联系方式</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <input type="text"   name="tel" value="" class="form-control "  ErrEmpty="联系方式不允许为空" />
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 must">
                                <div class="young-form-label">发布时间</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <input type="text" id="publishTime" value="" name="publishTime" class="form-control "  ErrEmpty="发布时间不允许为空" />
                                </div>
                            </div>
                            <div class="young-form-item col-md-6 ">
                                <div class="young-form-label">备注说明</div>
                                <div class="young-form-tips"></div>
                                <div class="young-form-input-block">
                                    <textarea  name="remark" value="" class="form-control "   ></textarea>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>

        <div class="tab-pane" id="yixiang" role="tabpanel">
            <div class="row">
                <div class="table-responsive">
                    <table class="table table-bordered table-hover table-line-auto" id="mainList" dataUrl="/recruit/jobIntention/getList" formUrl="/page/recruit/jobIntentionForm.html">
                        <col field="userName" title="投递用户" width="10%" align=""  />
                        <col field="[=jo.formatTime('{sendTime}')]" title="投递时间" width="15%" align=""  order="sendTime"/>
                        <col field="merchantResult" title="处理结果" width="10%" align=""  />
                        <col field="[=jo.formatTime('{merchantTime}')]" title="处理时间" width="15%" align=""  order="merchantTime"/>
                        <col field="opt" title="操作" width="15%" align=""/>
                    </table>
                </div>
            </div>
        </div>


    </div>



</div>

<!--配置信息-->
<script src="/static/js/config.js"></script>
<!--jquery-->
<script src="/static/plugin/jquery/jquery-3.3.1.js"></script>
<script src="/static/plugin/jquery/jquery.cookie.js"></script>
<!--bootstrap-->
<script src="/static/plugin/bootstrap/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="/static/plugin/other/html5shiv.js"></script>
<script src="/static/plugin/other/respond.min.js"></script>
<![endif]-->
<!--layui-->
<script src="/static/plugin/layui-2.4.3/layui.all.js"></script>
<!--ztree-->
<script src="/static/plugin/zTree/js/jquery.ztree.all.js"></script>
<!--common-->
<script src="/static/js/common.js"></script>
<!--jo-->
<script src="/static/plugin/jo/jo.js"></script>
<script src="/static/plugin/jo/jo-adapt.js"></script>
<script src="/static/plugin/jo/jo-page-view.js"></script>
<script src="/static/plugin/jo/jo-page-form.js"></script>
<script src="/static/plugin/jo/jo-listener.js"></script>
<script type="text/javascript">
    JoInputSimple('jobTime', '周六日全天,每天早上,每天中午,每天晚上,每天吃饭时间,其他');//初始化输入选择框
    layui.laydate.render({
        elem: '#publishTime' //注册日期控件
    });
    $(function(){
        var jParams = {
            "PKName" : "id",//主键属性名
            "saveAfter" : "toEdit",
            "addUrl" : "/recruit/job/insert",//新增
            "deleteUrl" : "/recruit/job/delete",//删除
            "updateUrl" : "/recruit/job/update",//修改
            "formDataUrl" : "/recruit/job/get",//查询
            //"readonly2Label" : true //只读转文本
        };
        joForm.initFormPage(jParams);//初始化


    });
    //初始化新增页面回调函数(在初始化按钮前发生)
    joForm.initFormPageOfAdd = function(){

    };
    //初始化表单值前处理
    joForm.initFormValueBefore = function(oJson){
        oJson.publishTime = jo.formatDate(oJson.publishTime);
    };
    //初始化表单值后处理
    joForm.initFormValueAfter = function(oJson){
        if(joForm.params.PKValue){
            $('#tab-option').show();
            joView.init({grid:$("#mainList"),PKName:"id", condition: 'jobId='+joForm.params.PKValue, checkStyle:'order'});//初始化页面
        }
    };
    //新增请求提交前回调函数
    joForm.dealDataAtSaveBefore = function(oJson){

    };
    //修改请求提交前回调函数
    joForm.dealDataAtUpdateBefore = function(oJson){

    };
    /* 关于joForm更多回调函数和配置参数可查看jo-page-form.js */
    joView.handleItem = function(oItem,iIndex){
        if(oItem.userId){
            oItem.userName = '<a class="cursor-hand" style="color:#4E97D9;cursor:point;" onclick="lookUser(\''+oItem.userId+'\')">'+oItem.userName+'</a>';
        }
        if(!oItem.merchantResult){
            oItem.opt = '<button type="button" class="btn btn-sm btn-success" onclick="agree(\''+oItem.id+'\')"><i class="fa fa-check" aria-hidden="true"></i>&nbsp;同意</button>';
            oItem.opt += '&nbsp;<button type="button" class="btn btn-sm btn-danger" onclick="disagree(\''+oItem.id+'\')"><i class="fa fa-close" aria-hidden="true"></i>&nbsp;拒绝</button>';
        }
        if(oItem.merchantResult == '同意'){
            oItem.merchantResult = '<span class="label label-success">同意</span>';
        }else if(oItem.merchantResult == '拒绝'){
            oItem.merchantResult = '<span class="label label-danger">拒绝</span>';
        }

    };
    //查看用户信息
    function lookUser(id){
        jo.showWin('/page/recruit/userInfo.html?id='+id, '600px', '400px', '用户信息');
    }
    function agree(id){
        if(!id){
            jo.showErrorMsg('意向无效');
            return;
        }
        jo.confirm('您确定同意此人的投递意向吗?', function(idx){
            jo.postAjax('/recruit/jobIntention/agree', {merchantResult: '同意', id: id}, function(json){
                if(json && json.code == 0){
                    jo.showSuccessMsg('操作成功');
                    joView.reloadCurrentPage();
                }else{
                    jo.showTipsMsg(json.info);
                }
            });
            jo.close(idx);
        });
    }
    function disagree(id){
        if(!id){
            jo.showErrorMsg('意向无效');
            return;
        }
        jo.confirm('您确定拒绝此人的投递意向吗?', function(idx){
            jo.postAjax('/recruit/jobIntention/update', {merchantResult: '拒绝', id: id}, function(json){
                if(json && json.code == 0){
                    jo.showSuccessMsg('操作成功');
                    joView.reloadCurrentPage();
                }else{
                    jo.showTipsMsg(json.info);
                }
            });
            jo.close(idx);
        });
    }
</script>
</body>
</html>
